package main

import "fmt"

func main() {

	student := StudentServiceImpl{}
	teacher := TeacherServiceImpl{}
	//student.BaseServiceAdd()
	entity := Entity{}
	working := WorkingService{}
	working.working(student, entity)
	working.working(teacher, entity)

}

type WorkingService struct {
}

func (w WorkingService) working(service BaseService, entity Entity) {
	service.BaseServiceAdd(entity)

}

type Entity struct {
	id      int
	name    string
	address string
}

// StudentService 用户接口
type BaseService interface {
	BaseServiceAdd(Entity) bool
	BaseServiceDelete()
	BaseServiceEdit()
	BaseServiceGet()
}

// StudentServiceImpl 用户 实现类
type StudentServiceImpl struct {
}

// BaseServiceAdd 实现 具体的方法
func (student StudentServiceImpl) BaseServiceAdd(e Entity) bool {
	fmt.Println("student...add()...")
	return true
}

func (student StudentServiceImpl) BaseServiceDelete() {
	fmt.Println("student...delete()...")
}

func (student StudentServiceImpl) BaseServiceEdit() {
	fmt.Println("student...edit()...")
}
func (student StudentServiceImpl) BaseServiceGet() {
	fmt.Println("student...get()...")
}

type TeacherServiceImpl struct {
}

// BaseServiceAdd 实现 具体的方法
func (t TeacherServiceImpl) BaseServiceAdd(e Entity) bool {
	fmt.Println("teacher...add()...")
	return true
}

func (t TeacherServiceImpl) BaseServiceDelete() {
	fmt.Println("teacher...delete()...")
}

func (t TeacherServiceImpl) BaseServiceEdit() {
	fmt.Println("teacher...edit()...")
}
func (t TeacherServiceImpl) BaseServiceGet() {
	fmt.Println("teacher...get()...")
}
